import os


PROXY_ENABLED = False   # 是否需要代理

PROXY_TYPE = 'POOL'  # 代理类型TUNNEL or POOL(隧道或代理池) or None

TUNNEL_PROXY_CONFIG = {
    'user': 'H93W1Y371N656V2D',
    'pass': '71573519584905EC',
    'host': 'http-dyn.abuyun.com',
    'port': '9020',
}

FAIL_TIME = 5   # 失败次数

REQUEST_MAX_NUMBER = 1  # 每次并发请求数

DELAY_ENABLED = True    # 是否启用下载延迟

DELAY_TIME = 2   # 延迟时间，基于[n, n+1)之间的随机数

STATUS_CODE = [200,]   # 接受的响应状态码

HEADERS = {     # 请求头
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
    'Accept-Encoding': 'gzip,deflate,br',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Host': 'www.meituan.com',
}

DOWNLOADER_MIDDLEWARE = {
    'Spider.util.Middleware.MyMiddleware': 500,
}

# Chrome执行路径
CHROME_PATH = 'C:/Users/张梦男/AppData/Local/Google/Chrome/Application/chrome.exe'
# Chromedriver执行路径
CHROMEDRIVER_PATH = 'C:/Users/张梦男/AppData/Local/Programs/Python/Python37/Scripts/chromedriver.exe'

# 获取cookie的页面，模拟登陆页面
GET_COOKIE_URL = 'https://passport.meituan.com/account/unitivelogin?service=www&continue=https%3A%2F%2Fwww.meituan.com%2Faccount%2Fsettoken%3Fcontinue%3Dhttps%253A%252F%252Fwww.meituan.com%252F'

# 初始url，获取所有城市的初始页面
GET_CITY_URL = 'https://www.meituan.com/changecity/'

USER = '美团账号'

PASSWORD = '美团密码'

UUID = '美团UUID'     # '71bbe335a74f4f438b05.1576821600.1.0.0'

REDIS_CONFIG = {    # redis配置信息
    'host': '127.0.0.1',
    'port': 6379,
    'url_list_name': 'spider_urls'  # 请求对象存放的队列名称
}

MYSQL_CONFIG = {    # mysql配置信息
    'host': '127.0.0.1',
    'port': 3306,
    'user': 'root',
    'password': 'root',
    'db': 'bysj',
    'charset': 'utf8',
}

MYSQL_TABLE_NAME = 'selectapp_meituanspider'    # mysql表名，数据存放表名

STATIC_FILE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static')

